/**
 *  *2010-8-13 下午04:19:18  add 
 */
package com.base.myproject.client.system;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import com.base.myproject.client.busi.MenuCommandFactory;
import com.base.myproject.client.busi.system.Bcodeself;
import com.base.myproject.client.jdbc.DataSet;
import com.base.myproject.client.tools.GreetingServiceAsync;
import com.base.myproject.client.ui.BaseJDBCPanel;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Label;

/**
 * @author Administrator 2010-8-13 javazgw@gmail.com
 */
public class OpenNewOnStartUp extends BaseJDBCPanel {
	String bcode;
	String bname;
	Hyperlink helfA;
	Label system;
	Hyperlink updatePassword = new Hyperlink("修改密码","");
	VerticalPanel vpCenter = new VerticalPanel();
	VerticalPanel vpEast = new VerticalPanel();
	VerticalPanel vpWest = new VerticalPanel();

	public OpenNewOnStartUp() {
		// 登录用户名
		this.bcode = Env.getEnvbcode();
		bname = Env.getEnvname();
		getSystemInfo();
		getRemind();
		init();
	}

	public void init() {
		updatePassword.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				new Bcodeself("").showDialog();
			}
		});
		initwidget();
	}

	Label lb4;

	private void initwidget() {
		final BorderLayout layout = new BorderLayout();
		setLayout(layout);
		setStyleAttribute("padding", "10px");

		vpEast.setSpacing(10);
		vpCenter.setSpacing(10);
		vpWest.setSpacing(10);

		ContentPanel west = new ContentPanel();
		west.setHeading("系统信息");
		west.add(vpWest);

		ContentPanel center = new ContentPanel();
		center.setHeading("信息提醒");
		center.add(vpCenter);
		center.setScrollMode(Scroll.AUTOX);

		ContentPanel east = new ContentPanel();
		east.setHeading("个人信息");
		Label bcodeLabel = new Label("登陆人员：" + bname);
		vpEast.add(bcodeLabel);
		vpEast.add(updatePassword);
		east.add(vpEast);

		ContentPanel south = new ContentPanel();
		south.setHeading("其他");

		BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH,
				100);
		northData.setCollapsible(true);
		northData.setFloatable(true);
		northData.setHideCollapseTool(true);
		northData.setSplit(true);
		northData.setMargins(new Margins(0, 0, 5, 0));

		BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 180);
		westData.setSplit(true);
		westData.setCollapsible(true);
		westData.setMargins(new Margins(0, 5, 0, 0));

		BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
		centerData.setMargins(new Margins(0));

		BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 180);
		eastData.setSplit(true);
		eastData.setCollapsible(true);
		eastData.setMargins(new Margins(0, 0, 0, 5));

		BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH,
				160);
		southData.setSplit(true);
		southData.setCollapsible(true);
		southData.setFloatable(true);
		southData.setMargins(new Margins(5, 0, 0, 0));

		// add(north, northData);
		add(west, westData);
		add(center, centerData);
		add(east, eastData);
		add(south, southData);
		// HorizontalPanel vp = new HorizontalPanel();
		// vp.setVerticalAlign(VerticalAlignment.TOP);
		// vp.setSpacing(5);
		//  
		// ContentPanel cp = new ContentPanel();
		// Draggable d = new Draggable(cp);
		// cp.setCollapsible(true); //控制是和否可以收缩
		// cp.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.menu_tool()));
		// cp.setBodyStyleName("pad-text");
		// cp.setHeading("审批任务");
		//	    
		// cp.add(getgrid());
		// Tools.setResize(cp,0.30,0.38);
		// d = new Draggable(cp, cp.getHeader());
		// d.setContainer(this);
		// d.setUseProxy(false);
		// vp.add(cp);
		//	    	    
		// cp = new ContentPanel();
		// cp.setCollapsible(true);
		// cp.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.menu_tool()));
		// cp.setBodyStyleName("pad-text");
		// cp.setHeading("合同到期");
		// cp.add(getgrid_ht());
		// Tools.setResize(cp,0.30,0.38);
		// d = new Draggable(cp, cp.getHeader());
		// d.setContainer(this);
		// d.setUseProxy(false);
		// vp.add(cp);
		//	    
		// cp = new ContentPanel();
		// cp.setCollapsible(true);
		// cp.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.menu_tool()));
		// cp.setBodyStyleName("pad-text");
		// cp.setHeading("健康证到期");
		// cp.add(create_bcode_cer_Grid());
		//	    
		// Tools.setResize(cp,0.30,0.38);
		// d = new Draggable(cp, cp.getHeader());
		// d.setContainer(this);
		// d.setUseProxy(false);
		// vp.add(cp);
		//
		//	    
		// add(vp);
	}

	public void getSystemInfo() {
		String formalSql = "select count(*) num from bcode_job where jobtype != '临时工' and employstatus = '在职'";
		//查所有在职除了临时工的员工
		String temporarySql = "select count(*) num from bcode_job where jobtype = '临时工' and employstatus = '在职'";
		//查所有的在职临时工的员工
		String sql = "select * from (" + formalSql + " union all "
				+ temporarySql + ") as b";
		selectCount(sql, 1);
	}

	Set<Map<String, String>> lists = new HashSet<Map<String, String>>();// 保存最终的文本和类名

	/**
	 * 得到用户在setRemind表中自定义的SQL语句和其它字段，通过查询和替换，将text字段替换成 具体的提示信息，再显示在界面上
	 */
	public void getRemind() {
		String sql = "select * from hr_setRemind order by icode asc"; // 查询用户自定义的SQL信息表，得到用户自定义的SQL语句，类名和显示的文本
		final GreetingServiceAsync greetingService = GWT
				.create(com.base.myproject.client.tools.GreetingService.class);
		greetingService.getDataSet(sql, new AsyncCallback<DataSet>() {
			@Override
			public void onFailure(Throwable caught) {
			}

			@Override
			public void onSuccess(DataSet result) {
				String select = "select * from (";
				for (int i = 0; i < result.getRowCount(); i++) {
					Map<String, String> map = new HashMap<String, String>();
					map.put("sql", result.getValue(i, "sql"));
					map.put("text", result.getValue(i, "text"));
					map.put("className", result.getValue(i, "className"));
					lists.add(map);
				}
				/*
				 * 这个循环不能放在上面的循环，因为把数据添加到set后，他会自动排列。所以如果放在上面的循环的话，
				 * 可能会使SQL语句和文本对应不上，所以会让显示出问题
				 */
				for (Map<String, String> map : lists) {
					select = select + map.get("sql") + " union all "; // 循环拼接SQL语句，查询不同的提示信息各自的个数
				}
				select = select.substring(0, select.length() - 11) + ") as b";
				selectCount(select, 0);
			}
		});
	}

	/**
	 * 执行查询个数的SQL语句
	 * @param select 查询所有提示信息各自的个数
	 * @param i 判断到底是系统信息还是提示信息，系统信息为1，提示信息为0，不同的i执行不同的操作
	 */
	public void selectCount(String select, final int i) {
		final GreetingServiceAsync greetingService = GWT
				.create(com.base.myproject.client.tools.GreetingService.class);
		greetingService.getDataSet(select, new AsyncCallback<DataSet>() {
			@Override
			public void onFailure(Throwable caught) {
			}

			@Override
			public void onSuccess(DataSet result) {
				if (result.getRowCount() > 0) {
					switch(i) {
					case 0 :
						Iterator<Map<String, String>> it = lists.iterator();
						Set<Map<String, String>> sets = new HashSet<Map<String, String>>();
						/*
						 * 循环得到查询的num的值，直接替换，现在没有做匹配，用的直接循环匹配的set，应该不会有问题
						 * 如果出现问题的话，就得找具体的匹配方式，保证查询的num值替换到正确的文本
						 */
						for (int i = 0; it.hasNext(); i++) {
							Map<String, String> map = it.next();
							String text = map.get("text");
							text = text.replaceAll("N", result.getValue(i, "num")); // 得到不同的个数后，替换SQL语句中的N，得到正确的显示文本
							Map<String, String> newsMap = new HashMap<String, String>();
							newsMap.put("className", map.get("className"));
							newsMap.put("text", text);
							newsMap.put("sql", map.get("sql"));
							sets.add(newsMap);
						}
						addRemind(sets);
						break;
					case 1 :
						int sum = 0;
						for (int i=0; i<result.getRowCount(); i++) {
							if (i == 0) {
								system = new Label("员工总人数：" + result.getValue(i, "num"));
							} else {
								system = new Label("编外人员总数：" + result.getValue(i, "num"));
							}
							sum = sum + Integer.parseInt(result.getValue(i, "num"));
							vpWest.add(system);
						}
						system = new Label("所有员工数：" + sum);
						vpWest.add(system);
						setLayout();
						break;
					}
				}
			}
		});
	}

	/**
	 * 向vpCenter中添加提示信息内容，并设置样式和单击事件
	 * @param lists 存放所有的提示信息要用到的文本和类名
	 */
	private void addRemind(Set<Map<String, String>> lists) {
		for (final Map<String, String> map : lists) {
			helfA = new Hyperlink("." + map.get("text"),"");
			helfA.setStyleName("label-font-color");
			helfA.addClickHandler(new ClickHandler() {
				public void onClick(ClickEvent event) {
					String className = map.get("className");
					MenuCommandFactory mcf = new MenuCommandFactory(className);
					mcf.setDispalyname(map.get("sql"));
					mcf.getCommand(className);
				}
			});
			vpCenter.add(helfA);
			setLayout();
		}
	}
	
	boolean set = false;  //因为页面会两次调用layout()，所以用这个作为判断
	//，如果第一次调用这个方法的话，就将set设置为true，第二次才执行
	private synchronized void setLayout() {
		if (set) {
			layout();
		} else {
			set = true;
		}
	}

	/*int passwordErrorNum = 3; // 记录可以再输入旧密码的次数
	int newPasswordErrorNum = 2; // 记录可以再输入新密码的次数
	// 用于验证用户输入第二次的新密码是否正确
	Listener<MessageBoxEvent> newPasswordListeren = new Listener<MessageBoxEvent>() {
		public void handleEvent(MessageBoxEvent be) {
			Button btn = be.getButtonClicked();
			if (btn.getText().equals("确定")) {
				final String newPassword = be.getValue();
				MessageBox.prompt("修改密码", "请再一次输入你的新密码",
						new Listener<MessageBoxEvent>() {
							public void handleEvent(MessageBoxEvent be) {
								Button btn = be.getButtonClicked();
								if (btn.getText().equals("确定")) {
									// 第二次密码跟第一次密码一致的话，修改密码成功
									if (be.getValue().equals(newPassword)) {
										String sql = "update bcode set password = '"
												+ newPassword
												+ "' where bcode = '"
												+ bcode
												+ "'";
										updatePassword(sql);
									} else {
										newPasswordErrorNum--;
										// 第二次密码跟第一次不一致的话，判断用户输入两次错误还是一
										// 次，如果是第一次错，让用户继续输入新密码
										// 如果第二次错了，直接提示用户这次修改失败
										if (newPasswordErrorNum <= 0) {
											Window
													.alert("不好意思，你连续2次输入新密码出错，所以此次修改密码不成功");
										} else {
											MessageBox
													.prompt(
															"修改密码",
															"两次密码不一致，此次修改失败。请输入你的新密码,你还有一次修改机会",
															newPasswordListeren);
										}
									}
								}
							}
						});
			}
		}
	};
	Listener<MessageBoxEvent> updatePass = new Listener<MessageBoxEvent>() {
		public void handleEvent(MessageBoxEvent be) {
			Button btn = be.getButtonClicked();
			// 判断用户输入的新密码正确与否
			if (btn.getText().equals("确定")) {
				String sql = "select password from bcode where bcode='" + bcode
						+ "' and password='" + be.getValue() + "'";
				GWT.log(sql);
				final com.base.myproject.client.tools.GreetingServiceAsync greetingService2 = GWT
						.create(com.base.myproject.client.tools.GreetingService.class);
				greetingService2.getDataSet(sql, new AsyncCallback<DataSet>() {

					@Override
					public void onFailure(Throwable caught) {
					}

					@Override
					public void onSuccess(DataSet result) {
						// 旧密码正确，提示用户输入新密码
						if (result.getRowCount() > 0) {
							passwordErrorNum--;
							MessageBox.prompt("修改密码", "请输入你的新密码",
									newPasswordListeren);
						} else {
							passwordErrorNum--;
							// 旧密码错误，判断用户已经输入多少次旧密码了，输入3次的话提示
							// 用户更改失败，并且把修改密码的按钮变成不可用
							if (passwordErrorNum <= 0) {
								Window
										.alert("不好意思，你连续3次输入旧密码出错，修改密码失败，并且此次登陆不能再修改密码");
								updatePassword.setEnabled(false);
							} else {
								MessageBox.prompt("修改密码", "输入有误，请再次输入你的旧密码，你还有"
										+ passwordErrorNum + "次机会", updatePass);
							}
						}
					}
				});
			}
		}
	};

	*//**
	 * 发送RPC修改密码
	 * 
	 * @param sql
	 *            更新密码的的SQL语句
	 * @return 更新成功与否，暂时没作用
	 *//*
	public boolean updatePassword(String sql) {
		CommandSyncsql csql = new CommandSyncsql();// 执行sql命令
		String delsql = sql;
		csql.getV().add(delsql);
		if (csql.getV().size() <= 0) {
			return false;
		} else {
			CommandSyncContainer list = new CommandSyncContainer();// 可以添加的命令
			list.add(csql);

			GreetingServiceAsync greetingService = GWT
					.create(GreetingService.class);
			greetingService.SendCommandSync(list,
					new AsyncCallback<CommandSyncReturnObject>() {
						@Override
						public void onFailure(Throwable caught) {
							MessageBox.alert("错误", "网络连接失败", null);
						}

						@Override
						public void onSuccess(CommandSyncReturnObject result) {
							if (result.isB()) {
								Info.display("提示信息", "修改密码成功");
							} else {
								MessageBox.alert("错误", "修改密码失败，原因是"
										+ result.getMessage(), null);
							}
						}
					});
		}
		return true;
	}

	Listener<BaseEvent> defaultlistener;
	private Listener<? extends BaseEvent> getListener() {
		if (defaultlistener != null) {
			return defaultlistener;
		}

		defaultlistener = new Listener<BaseEvent>() {
			public void handleEvent(BaseEvent be) {
				new Bcodeself("").showDialog();
				Dialog dialog = new Dialog();
				
				Label passwordOld = new Label("旧密码:");
				passwordOld.setWidth("100");
				Label passwordNew = new Label("新密码:");
				passwordNew.setWidth("100");
				Label passwordConfirm = new Label("确认新密码:");
				passwordConfirm.setWidth("100");
				
				TextField<String> oldPassword = new TextField<String>();
				oldPassword.setWidth("150");
				TextField<String> newPassword = new TextField<String>();
				newPassword.setWidth("150");
				TextField<String> confirmPassword = new TextField<String>();
				confirmPassword.setWidth("150");
				oldPassword.setPassword(true);
				newPassword.setPassword(true);
				confirmPassword.setPassword(true);
				Button confirm = new Button("提交");
				
				VerticalPanel hp = new VerticalPanel();
				H
				
				dialog.setHeading("修改密码");
				dialog.add(passwordOld);
				dialog.add(oldPassword);
				dialog.add(passwordNew);
				dialog.add(newPassword);
				dialog.add(passwordConfirm);
				dialog.add(confirmPassword);
				dialog.add(confirm);
				dialog.setWidth(300);
				dialog.setHeight(200);
				dialog.show();
			}
		};
		return defaultlistener;
	}*/

	// -- 审批任务
	// BaseStore<BusiObject> store = null;
	// BaseStore<BusiObject> getStore() {
	// if (store == null) {
	// createStore();
	// }
	// return store;
	// }
	// BaseStore<BusiObject> createStore() {
	// ModelType type = new ModelType();
	// type.setRoot("records");
	// type.setRecordName("record");
	// type.setTotalName("totle");
	// type.addField("dbid_");
	// type.getField("dbid_").setType(Integer.class);
	// type.addField("name_");
	// type.getField("name_").setType(String.class);
	// type.addField("create_");
	// type.getField("create_").setType(Date.class);
	// type.addField("execution_id_");
	// type.getField("execution_id_").setType(String.class);
	// StoreInfo info = new StoreInfo();
	// info.setTablename("null");
	// info.setKeyname(new String[] { "icode" });
	// info
	// .setSql("select top 5  task.dbid_,task.name_ ,task.create_,task.execution_id_ from jbpm4_task task   left join jbpm4_participation pt on task.DBID_=pt.TASK_    where task.ASSIGNEE_='"+bcode+"' or ( pt.TYPE_ = 'candidate' and (pt.USERID_='"+bcode+"')   or pt.GROUPID_ in ('"+bcode+"')) order by create_ desc");
	// store = new BaseStore<BusiObject>(type, info);
	// return store;
	// }
	// BaseGridPanel gridpanel = null;
	// BaseGridPanel getgrid() {
	// if (gridpanel == null) {
	// createGrid();
	// }
	// return gridpanel;
	// }
	// BaseGridPanel createGrid() {
	// CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
	// List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
	// columns.add(cbs.getColumn());
	// ColumnConfig C2 = new ColumnConfig("name_", "任务名称", 120);
	// columns.add(C2);
	// ColumnConfig C3 = new ColumnConfig("create_", "任务提交时间", 120);
	// C3.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss"));
	// columns.add(C3);
	// ColumnModel cm = new ColumnModel(columns);
	// gridpanel = new BaseGridPanel(getStore(), cm,false,false);
	// cbs.setSelectionMode(SelectionMode.SINGLE);
	// gridpanel.getBg().setSelectionModel(cbs);
	// gridpanel.getBg().setHeight(200);
	// gridpanel.getBg().setWidth(297);
	// return gridpanel;
	// }
	// //--
	// //--合同到期
	// BaseStore<BusiObject> store_ht = null;
	// BaseStore<BusiObject> getStore_ht(){
	// if(store_ht==null)
	// {
	// createStore_ht();
	// }
	// return store_ht;}
	// BaseStore<BusiObject> createStore_ht(){
	// ModelType type = new ModelType();
	// type.setRoot("records");
	// type.setRecordName("record");
	// type.setTotalName("totle");
	// type.addField("icode");
	// type.getField("icode").setType(Long.class);
	// type.addField("bcode");
	// type.getField("bcode").setType(String.class);
	// type.addField("contractstartdate");
	// type.getField("contractstartdate").setType(Date.class);
	// type.addField("contractsenddate");
	// type.getField("contractsenddate").setType(Date.class);
	// StoreInfo info = new StoreInfo();
	// info.setTablename("bcode_job");
	// info.setKeyname(new String[] { "icode"});
	// info.setSql("select top 5 * from  bcode_job where contractsenddate<=DATEADD(DAY,5,getdate()) and  contractsenddate is not null order by contractsenddate desc");
	// store_ht = new BaseStore<BusiObject>(type, info);
	// return store_ht;
	// }
	// BaseGridPanel grid_ht=null;
	// BaseGridPanel getgrid_ht() {
	// if (grid_ht == null) {
	// createGrid_ht();
	// }
	// return grid_ht;
	// }
	// BaseGridPanel createGrid_ht(){
	// CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
	// List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
	// columns.add(cbs.getColumn());
	//
	// ColumnConfig C2 = new ColumnConfig("bcode", "员工姓名", 120);
	// BaseComboBoxForm<BaseModelData> bsb2 = new
	// BaseComboBoxForm<BaseModelData>("bcode","bname","bcode","",true);
	// C2.setRenderer(bsb2);
	// C2.setEditor(bsb2.getCelEditor());
	// columns.add(C2);
	//
	// ColumnConfig C17 = new ColumnConfig("contractsenddate", "合同终止日期", 140);
	// C17.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
	// columns.add(C17);
	// ColumnModel cm = new ColumnModel(columns);
	// grid_ht = new BaseGridPanel(getStore_ht(), cm);
	// cbs.setSelectionMode(SelectionMode.SINGLE);
	// grid_ht.getBg().setSelectionModel(cbs);
	// grid_ht.getBg().setHeight(200);
	// grid_ht.getBg().setWidth(297);
	// return grid_ht ;}
	// //--
	// //--健康证
	// BaseStore<BusiObject> bcode_cer_store = null;
	//
	// BaseStore<BusiObject> get_bcode_cer_Store() {
	// if (bcode_cer_store == null) {
	// create_bcode_cer_Store();
	// }
	// return bcode_cer_store;
	// }
	// BaseStore<BusiObject> create_bcode_cer_Store() {
	// ModelType type = new ModelType();
	// type.setRoot("records");
	// type.setRecordName("record");
	// type.setTotalName("totle");
	// type.addField("icode");
	// type.getField("icode").setType(Long.class);
	// type.addField("bcode");
	// type.getField("bcode").setType(String.class);
	// type.addField("no_");
	// type.getField("no_").setType(String.class);
	// type.addField("cerSpecies");
	// type.getField("cerSpecies").setType(String.class);
	// type.addField("certype");
	// type.getField("certype").setType(String.class);
	// type.addField("cerno");
	// type.getField("cerno").setType(String.class);
	// type.addField("DMSno");
	// type.getField("DMSno").setType(String.class);
	// type.addField("mark");
	// type.getField("mark").setType(String.class);
	// type.addField("availableDate");
	// type.getField("availableDate").setType(Date.class);
	// StoreInfo info = new StoreInfo();
	// info.setTablename("bcode_cer");
	// info.setSql("select * from bcode_cer where availableDate<=DATEADD(DAY,5,getdate()) and  availableDate is not null order by availableDate desc");
	// info.setKeyname(new String[] { "icode" });
	// // 关联主表字段
	// bcode_cer_store = new BaseStore<BusiObject>(type, info);
	// return bcode_cer_store;
	// }
	// BaseGridPanel bcode_cer_grid = null;
	//
	// BaseGridPanel create_bcode_cer_Grid() {
	// CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
	// List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
	// columns.add(cbs.getColumn());
	//
	// ColumnConfig C2 = new ColumnConfig("bcode", "员工姓名", 80);
	// BaseComboBoxForm<BaseModelData> bsb2 = new
	// BaseComboBoxForm<BaseModelData>("bcode","bname","bcode","",true);
	// C2.setRenderer(bsb2);
	// C2.setEditor(bsb2.getCelEditor());
	// columns.add(C2);
	//
	// ColumnConfig C8 = new ColumnConfig("availableDate", "有效日期", 80);
	// DateField dateField8 = new DateField();
	// dateField8.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
	// C8.setEditor(new CellEditor(dateField8));
	// C8.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
	// columns.add(C8);
	// ColumnModel cm = new ColumnModel(columns);
	// bcode_cer_grid = new BaseGridPanel(get_bcode_cer_Store(), cm, true,
	// true);
	// cbs.setSelectionMode(SelectionMode.SINGLE);
	// bcode_cer_grid.getBg().setSelectionModel(cbs);
	// bcode_cer_grid.getBg().setHeight(200);
	// return bcode_cer_grid;
	// }
	// --

}
